#include<iostream>
#include<cstring>
using namespace std;
class aa
{
private:
    int val;
public:
    aa(int v = 0) :val(v) {}
    aa operator+(const aa& b)
    {
        int sum = val + b.val;
        int n = 0;//计算几位数
        int num[10000];//存储每一位
        memset(num, 0, sizeof(num));
        while (sum > 0)
        {
            num[n++] = sum % 10;
            sum /= 10;
        }
        for (int i = 0; i < n; ++i)
        {
            if (num[i] >= 4)
            {
                num[i + 1] = num[i + 1] + num[i] / 4;
                num[i] %= 4;
            }
        }
        int i = 0;
        int vv = 0;
        int tmp = 1;
        for (int i = 0; i <= n; ++i)
        {
            vv = vv + num[i] * tmp;
            tmp *= 10;
        }
        aa ans(vv);
        return ans;
    }
    friend ostream& operator<<(ostream& os, const aa& b)
    {
        os << b.val;
        return os;
    }
};
int main()
{
    int t;
    cin >> t;
    int num;
    cin >> num;
    aa ans(num);
    while (--t)
    {
        cin >> num;
        ans = ans + aa(num);
    }
    cout << ans << endl;
}